package com.xmfh.wemedia.controller;

import com.xmfh.wemedia.service.IDdAddViewsService;
import com.xmfh.wemedia.service.impl.DdAddViewsServiceImpl;
import com.xmfh.wemedia.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: lanlan
 * @Data: 2022/4/5 20:04
 * @Description:增加浏览量
 */
@RestController
@RequestMapping("/wemedia/addViews")
public class DdAddViewsController {
    @Autowired
    IDdAddViewsService  addViewsService;

    @GetMapping("/list")
    public String list(){
        return "操作成功";
    }

    /**
     * 增加浏览量
     * @param type
     * @param id
     */
    @RequestMapping("/{type}/{id}")
    public JsonResult<Void> addViews(@PathVariable String type,@PathVariable Integer id){
        int rows = addViewsService.addViews(type, id);
        return JsonResult.ok();
    }
}
